#include <stdlib.h>

#include "objects.h"
#include "glovars.h"

struct global *glovars = NULL;

struct global *
glo_lookup(scm nm)
{
	struct global *g;

	if (!glovars) return NULL;
	
	for(g = glovars; g; g = g->next) {
		if (g->name == nm)
			return g;
	}
	
	return NULL;
}

void
glo_define(scm name, scm arity, scm value)
{
	struct global *link = malloc(sizeof(struct global));

	link->val = value;
	link->name = name;
	link->arity = arity;
	link->next = glovars;

	glovars = link;
}
